#include "highgui.h"
#include <iostream>

using namespace std;

int main(int argc, char** argv){
	cvNamedWindow("Camera", CV_WINDOW_AUTOSIZE);
	CvCapture* capture = cvCreateCameraCapture(-1);
	IplImage* frame;
	while(1){
		frame = cvQueryFrame(capture);
		if(!frame){cout << "Oh noes!" << endl;continue;}
		cvShowImage("Camera", frame);
		char c = cvWaitKey(33);
		if(c == 27) break;
	}
	cout << "done\n";
	cvReleaseCapture(&capture);
	cvDestroyWindow("Camera");
}
